from django.http import HttpResponse
import random

dynamite = 0

def random_bot(request):
    global dynamite
    if dynamite > 0:
        play = random.choice(('rock', 'paper', 'scissors', 'dynamite',))
        if play == 'dynamite':
            dynamite -= 1
        return HttpResponse(play)
    else:
        return HttpResponse(random.choice(('rock', 'paper', 'scissors',)))

def random_bot_outcome(request):
    return HttpResponse("ok")

def random_bot_introduction(request):
    data = eval(request["data"])
    global dynamite_remaining
    dynamite = int(float(data["round_count"]) * .05)
    return HttpResponse("{\"bot_name\":\"RandomBot\", \"author\":\"Justin Bozonier\"}")